<?php

namespace SummoIngenio\Sai\MatematicaBundle\Utility\Juego\P0;
use SummoIngenio\Sai\MatematicaBundle\Utility\Juego\JuegoBase;
define('CANT_PROBLEMAS', 5);
/**
 * Description of P01050
 *
 * @author SVM
 */

class P01050 extends JuegoBase {
  
  public function init() {
	$this->base=10;
	$this->op1=rand(1,9);
	$this->op2=rand(10-$this->op1,10);
	$this->op3=rand(1,(20-($this->op1+$this->op2)));	
  }
  
  public function getPregunta() {
    return '';
  }
  public function getHtmlDesactivado() {	
    return $this->render('P0/P01050/desactivado', array(
        'op1'   =>  $this->op1,		
        'op2'   =>  $this->op2,
        'op3'   =>  $this->op3,	
      ));
  }
  
  public function getHtmlJugable() {
    return $this->render('P0/P01050/jugable', array(
        'op1'   =>  $this->op1,		
        'op2'   =>  $this->op2,
        'op3'   =>  $this->op3,	
      ));
  }
  
  public function getHtmlResuelto() {
    return $this->render('P0/P01050/resuelto', array(
        'op1'   =>  $this->op1,		
        'op2'   =>  $this->op2,
        'op3'   =>  $this->op3,	
      ));
  }
  
  public function verificarRespuesta($respuestaUsuario) {
     $rsp = true;
	 $cadena1 = $this->op1+"+"+$this->op2+"+"+$this->op3+"="+$respuestaUsuario->get('valor1');
     $cadena = $cadena1;
	 if($respuestaUsuario->get('valor1')!=$this->op1+$this->op2+$this->op3){ 
	   $rsp=false;
	 }	 
    $aRetornar = array(
      'respuesta' => $cadena,
      'correcta'  => $rsp,
    );
    return $aRetornar;
  }

  public function getJavascript() {
    $aRetornar = array(
      "tipo"      => "archivo",
      "contenido" => "P0/P01050.js"
    );
    return $aRetornar;
  }

  public function getCss() {
    $aRetornar = array(
      "tipo"      => "archivo",
      "contenido" => "P0/P01050.css"
    );
    return $aRetornar;
  }

  public function __sleep() {
    return array(
        'op1',		
        'op2',
        'op3',
    );
  }
}

?>